<!doctype html>
<html>
<head>

	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
	
	<link href="css/1140.css" type="text/css" rel="stylesheet" />
	<link href="css/main.css" type="text/css" rel="stylesheet" />
	
	<?php 
	include 'functions.php';
	include 'stats_functions.php';
	include 'analysis_2014_fall.php';
	?>
    
</head>
<body>

<div class="container12">

	<div class="row column12">
		<h2>List of Files</h2>
	</div>
	
	<div class="files">
	
		<div class="row">
			<div class="column6">Filename</div>
			<div class="column2">Analysis</div>
			<div class="column4">Size</div>
		</div>
		
		<?php
		$i = 1;
		$di = new RecursiveDirectoryIterator('surveys1/');
		foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
			if(substr($filename, 1) != "." && substr($filename, -4) == '.csv') {
		        echo '<div class="row">';
				echo '	<div class="column6"><a href="' . $filename . '">' . $filename . '</a></div>';
				echo '	<div class="column2"><a href="" id="file_' . $i . '">Do Analysis</a></div>';
				echo '	<div class="column4">' . $file->getSize() . ' bytes</div>';
				echo '</div>';
				$i++;
			}
	    }
		?>
	
	</div>
	
	<?php 
	
	// the 2 files for analysis
	$fileName1 = 'surveys1/2014_fall/westview_voyage/Westview_Begin.csv';
	$fileName2 = 'surveys1/2014_fall/westview_voyage/Westview_End.csv';
	
	// open and store the first file
	$data1 = get_file($fileName1);
	// remove first row
	unset($data1[0]);
	// remove rows without matches and re-label keys
	foreach($data1 as $rowKey => $row) {
		$m = $data1[$rowKey][GEN_MATCH];
		if(!empty($m))
			$data1[$m] = $data1[$rowKey];
		unset($data1[$rowKey]);		
	}
	//echo '<h1>Data1</h1>'; ee_print_array($data1); die();
	
	// open and store the second file
	$data2 = get_file($fileName2);
	// remove first row
	unset($data2[0]);
	// remove rows without matches and re-label keys
	foreach($data2 as $rowKey => $row) {
		$m = $data2[$rowKey][GEN_MATCH];
		if(!empty($m))
			$data2[$m] = $data2[$rowKey];
		unset($data2[$rowKey]);	
	}
	//echo '<h1>Data2</h1>'; ee_print_array($data2); die();
	
	
	/*echo '<h2>Student Learning</h2>';
	do_quant_eval($data1, $data2, "1-1");
	do_quant_eval($data1, $data2, "1-3");
	do_quant_eval($data1, $data2, "1-19");*/
	
	/*echo '<h2>High School</h2>';
	do_quant_eval($data1, $data2, "1-4");
	do_quant_eval($data1, $data2, "1-5");
	do_quant_eval($data1, $data2, "1-6");*/
	
	echo '<h2>College/Career</h2>';
	//do_quant_eval($data1, $data2, "1-7");
	//do_quant_eval($data1, $data2, "1-18");
	//do_quant_eval($data1, $data2, "1-8");
	//do_quant_eval($data1, $data2, "1-9");
	//do_quant_eval($data1, $data2, "1-10");
	
	?>
	
	
	
	
</div>

</body>
</html>
